/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package vm;

import java.util.LinkedList;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Peer
 */
public class StackTableModel extends AbstractTableModel {

    LinkedList data;

    public int getRowCount() {
        return 1;
    }

    public int getColumnCount() {
        if(data!=null)
            return data.size();
        else
            return 0;
    }

    public Object getValueAt(int rowIndex, int columnIndex) {
        try {
            return data.get(columnIndex);
        } catch (Exception e) {
            return "";
        }
    }

    @Override
    public String getColumnName(int column) {
        return "S"+column;
    }

    public void setData(LinkedList data) {
        this.data = data;
    }

}
